<!DOCTYPE html>
<html lang="en" ng-app='bsh'>
<head>
	<meta charset="UTF-8">
	<title>百商汇</title>
	<meta name="viewport" content="initial-scale = 1.0,maximum-scale = 1.0,minimum-scale = 1.0,user-scalable = no,width = device-width">
	<meta name="format-detection" content="telephone=no" />
	<link rel="stylesheet" type="text/css" href="./csses/homepage.css">
	<link rel="stylesheet" type="text/css" href="./csses/personal.css">
	<link rel="stylesheet" type="text/css" href="./csses/message.css">
	<link rel="stylesheet" type="text/css" href="./csses/idangerous.swiper.css">
	<style type="text/css">
		*{
			margin: 0;
			padding: 0;
			font-family: '微软雅黑';
		}

		.bigBox{
			width: 100%;
			height: auto;
		}

		
	</style>
</head>
<body>
	<div class="bigBox">
		<div ng-view></div>
	</div>

	
	<footer>
		<ul>
			<li class="homepage">
				<a href="#!/homepage">
					<img src="./image/homepage_.png">
					<span>首页</span>
				</a>
			</li>
			<li class="message">
				<a href="#!/message">
					<img src="./image/message.png">
					<span>消息</span>
				</a>
			</li>
			<li class="personal">
				<a href="#!/personal">
					<img src="./image/personal.png">
					<span>我</span>
				</a>
			</li>
		</ul>
	</footer>
	<script type="text/javascript" src="./lib/angular.min.js"></script>
	<script type="text/javascript" src="./lib/angular-route.js"></script>
	<!-- <script type="text/javascript" src="./lib/flexible.js"></script> -->
	<script type="text/javascript" src="./lib/jquery-2.1.1.min.js"></script>
	<script type="text/javascript" src="./lib/idangerous.swiper.min.js"></script>
	<script type="text/javascript" src="./lib/iscroll.js"></script>
	<script type="text/javascript" src="./javascript/pullToRefresh.js"></script>
	<script>
		var bshWX = angular.module('bsh',['ngRoute']);
			bshWX.config(['$routeProvider','$locationProvider',function($routeProvider,$locationProvider){
				$locationProvider.html5Mode(false).hashPrefix('!');
				$routeProvider
					.when('/homepage',{
						templateUrl : './views/homepage.html',
						controller : 'homepageCtrl'
					})
					.when('/message',{
						templateUrl : './views/message.html',
						controller : 'messageCtrl'
					})
					.when('/personal',{
						templateUrl : './views/personal.html',
						controller : 'personalCtrl'
					})
					.otherwise({redirectTo : '/homepage'})
			}])
			.run(function($rootScope,$window,$location){
				$rootScope.$on('$routeChangeSuccess',
					function(event,next,current){
						if(!$window.sessionStorage.token){
							if($location.path() != '/login' && $location.path() != '/homepage'){
								$window.location.href = 'views/login.html';
							}
						}else if($window.sessionStorage.userName && $window.sessionStorage.token){
							if($location.path() == '/homepage'){
								$('.homepage img').attr('src','./image/homepage_.png');
								$('.homepage span').css('color','#dc4b19');
								$('.message img').attr('src','./image/message.png');
								$('.message span').css('color','#ccc');
								$('.personal img').attr('src','./image/personal.png');
								$('.personal span').css('color','#ccc');
							}else if($location.path() == '/message'){
								$('.homepage img').attr('src','./image/homepage.png');
								$('.homepage span').css('color','#ccc');
								$('.message img').attr('src','./image/message_.png');
								$('.message span').css('color','#dc4b19');
								$('.personal img').attr('src','./image/personal.png');
								$('.personal span').css('color','#ccc');
							}else if($location.path() == '/personal'){
								$('.homepage img').attr('src','./image/homepage.png');
								$('.homepage span').css('color','#ccc');
								$('.message img').attr('src','./image/message.png');
								$('.message span').css('color','#ccc');
								$('.personal img').attr('src','./image/personal_.png');
								$('.personal span').css('color','#dc4b19');
							}
						}
				});
			});
	</script>
	
	<script type="text/javascript">
		var html = document.getElementsByTagName('html')[0];
		var dpr = window.devicePixelRatio;
		html.style.fontSize = innerWidth/10 + 'px';
		html.setAttribute('data-dpr',dpr);

		function goBack(){
			$('.merchantDetailBox').css('display','none');
			$('.homepage_box').css('display','block');
			$(document).scrollTop(sessionStorage.scrollTopValue);
		}
	</script>
	<script type="text/javascript" src="./javascript/controllers.js"></script>
</body>
</html>